#import "Example.h"
#import "PALabel.h"
@interface Example()

@end


@implementation Example

- (NSString *)libraryName {
    // TODO: 返回正确的库名
    return @".xml";
}

+ (NSDictionary *)dataMap {
    return @{
        // @"" : @"identifier:identifier:"
    };
}

-(id)initWithDictionary:(NSDictionary *)dictionary {
    self = [super initWithLinkage:@"" andDictionary:dictionary];
    if(self){
      
    }
    return self;
}

- (void)configureWithDictionary:(NSDictionary *)dictionary {
    
    //获取字符串数据
        NSString  * stringValue  = [dictionary valueForKey:@"string_value"];
        int intValue  = [[dictionary valueForKey:@"int_value"] intValue];
        //如果需要string类型
        NSString * intStringForInt = [NSString stringWithFormat:@"%i",[[dictionary valueForKey:@"int_value"] intValue]];
        
        //获取文本实例
        PALabel * titleLabel = [self.mV getChildByName:@"title_label"];
        
        //文本赋值
        titleLabel.string = stringValue;
        titleLabel.string = intStringForInt;
        
        //按钮
        PAMovieClip * close_btn =  [self.mV getChildByName:@"close_btn"];
        
        //按钮添加监听
        [close_btn attachEventListener:ON_CLICK withTarget:self andSelector:@"closeButtonOnClicked:andParams:" andParams:dictionary];
        
        //图片
        PAMovieClip * imageHolder = [self.mV getChildByName:@"imageHolder"];
        
        //图片赋值
        [self loadImageToHolder:imageHolder withFilename:@"url"];
        
        //置灰操作(YES 是置灰。NO是取消置灰)
        [close_btn setGrayscale:YES];
        
        //设置显示隐藏
        [close_btn setVisible:YES];
}
 
-(void)closeButtonOnClicked:(PAMovieClip*)sender withParams:(NSDictionary*)params{
    NSLog(@"close button clicked!");
    //TODO: 这里需要添加处理逻辑
}

-(void) onExit {
    [super onExit];
}

@end


